import React, { useRef, useEffect } from "react";
import Nav from "../Components/Nav";
import DeskTop from "../Components/DeskTop";
import Footer from "../Components/Footer";
import "./index.less";

export default function Agriculture() {
  const desktop = useRef(null);
  const topContainer = useRef(null);

  useEffect(() => {
    console.log(desktop, "desktop", topContainer);
    if (desktop.current && topContainer.current) {
      document.addEventListener("scroll", () => {
        if (
          document.documentElement.scrollTop >=
          topContainer.current.clientHeight
        ) {
          desktop.current.classList.add(["activeDeskTop"]);
        } else {
          desktop.current.classList.remove("activeDeskTop");
        }
      });
    }
  }, []);

  return (
    <div>
      <Nav ref={topContainer} />
      <DeskTop ref={desktop} />
      <div className="component">
        <div className="container">
          <div className="left"> Agriculture Equipment and Machinery</div>
          <div className="right">
            <p>AGRICULTURE EQUIPMENT AND MACHINERY</p>
            <p>
              JCB has been producing agriculture machinery since 1945, when
              Joseph Cyril Bamford built his first trailer. We’ve always
              understood that, when it comes to agriculture machinery, only the
              very greatest levels of performance and productivity will do.
            </p>
            <p>
              That’s why we’ve always believed in developing specialised
              agriculture machinery; Backhoe Loaders were introduced in 1953,
              Hydraulic Excavators in 1963, Loadalls in 1977 and Midi Excavators
              in 1983.
            </p>
            <p>
              We’ve also always believed in using innovation and technology to
              make our agriculture equipment as efficient as possible. In 2006
              we introduced TorqueLock to reduce fuel consumption and increase
              top speeds. In 2010 we patented Adaptive Load Control to improve
              safety and stability on our telescopic machines.
            </p>
            <p>
              And we’re not stopping there with our agriculture machinery
              either; we’ll carry on developing new solutions, improving and
              expanding our range to meet our customers’ future needs and
              expectations.
            </p>
          </div>
        </div>
      </div>
      <Footer />
    </div>
  );
}
